Combining Manifest Contracts with State
نویسنده
چکیده
Manifest contracts combine the rich specifications and runtime checking of higher-order contracts [11] with a static type discipline. Conventional type systems prevent simple errors, like calling a boolean as a function, but manifest contracts can prevent more complex errors. For example, we could give the sqrt function the very precise type {x:Float | x ≥ 0} → {y:Float | |x − y| < }, where subset types like {x:Float | x ≥ 0} refer to those floating-point numbers x such that x ≥ 0. Extending types with contract-like specifications in code yield powerful reasoning principles [5, 22] and better abstractions [14]. Sound manifest contract systems enjoy an inversion principle, invaluable for reasoning about parameters in function bodies:
منابع مشابه
Deadlocks and Livelocks in Concurrent Objects with Futures
We study FJf, a concurrent object calculus with future types and operations for getting the values and releasing the control. Programs in FJf may manifest locks (deadlocks or livelocks) due to badly programmed release points. In order to statically detect possible misbehaviours, we develop a technique for the lock analysis based on contracts, which are abstract descriptions of method’s behaviou...
متن کاملPolymorphic Contracts
Manifest contracts track precise properties by refining types with predicates—e.g., {x :Int | x > 0} denotes the positive integers. Contracts and polymorphism make a natural combination: programmers can give strong contracts to abstract types, precisely stating preand post-conditions while hiding implementation details—for example, an abstract type of stacks might specify that the pop operation...
متن کاملSpace-Efficient Latent Contracts
Standard higher-order contract monitoring breaks tail recursion and leads to space leaks that can change a program’s asymptotic complexity; space-efficiency restores tail recursion and bounds the amount of space used by contracts. Space-efficient contract monitoring for contracts enforcing simple type disciplines (a/k/a gradual typing) is well studied. Prior work establishes a space-efficient s...
متن کاملDebt contracts with ex - ante and ex - post asymmetric information : an example
We consider a simple model of lending and borrowing combining two informational problems: adverse selection and costly state verification. Our analysis highlights the interaction between these two informational problems. We notably show that the higher the monitoring cost, the less discriminating the optimal menu of contracts is.
متن کاملRepeated Interactions and Contractual Detail: Identifying the Learning Effect
Organizations interacting repeatedly on similar transactions may learn from prior experiences, allowing contracts to be specified in greater detail. In this study, we analyze the conditions under which this learning effect is most likely to manifest itself. We do this by focusing on different parts of a contract as well as differences across transacting parties. Using a survey of information te...
متن کامل